package com.fany.views.circlemenu;

import android.graphics.PointF;
import android.graphics.Rect;

public class CircleArea
{
	public PointF centerPoint;
	public float radius;
	public Rect area;

	public CircleArea()
	{
		centerPoint = new PointF();
		area = new Rect();
	}

	public void adjustArea(PointF point, float radius)
	{
		centerPoint.x = point.x;
		centerPoint.y = point.y;
		this.radius = radius;
		area.left = (int) (Math.max(0, centerPoint.x - radius));
		area.right = (int) (centerPoint.x + radius);
		area.top = (int) (Math.max(0, centerPoint.y - radius));
		area.bottom = (int) (centerPoint.y + radius);
	}

	public boolean isPointInArea(float x, float y)
	{
		return (x > area.left) && (x < area.right) && (y > area.top) && (y < area.bottom);
	}
}
